<?php

    function smarty_function_label($params, &$smarty)
	{
		$id = $params["id"]; // required. id value all time page or view class member value name.

		if (isset($_POST["Control:$id"]) && isset($smarty->Controls[$id]) == false)
		{
			$smarty->Controls[$id] = $_POST["Control:$id"];
		}
		$text = (isset($smarty->Controls[$id])) ? $smarty->Controls[$id] : $params["text"]; // required

		if (strlen($text) > 0)
		{
			echo "<label>$text</label>";
		}
	}

?>
